#include <iostream>
#include <vector>
using namespace std;

class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        // 首先保留nums[0]
        int k = 1;
        for (int i = 1; i < nums.size(); i++)
        {
            if (nums[i] != nums[i - 1])
            {
                nums[k] = nums[i];
                k++;
            }
            
        }
        return k;
    }
};


int main(){

    vector<int> v;
    for (int i = 0; i < 10; i++)
    {
        v.push_back(i);
        v.push_back(i + 1);
    }
    Solution s;
    int res = s.removeDuplicates(v);
    cout << "the result is : " << res << endl;
    return 0;
}